package com.jash.labor.controller;


import com.jash.labor.entity.Station;
import com.jash.labor.service.StationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@Api(tags = "岗位相关接口")
@RestController
@RequestMapping(value = "/station",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class StationController {

    @Resource
    private StationService stationService;
    @RequestMapping("/add")
    public Object add(@RequestBody Station station){

        return stationService.add(station);

    }

    @RequestMapping("/edit")
    public Object edit(@RequestBody Station station){

        return stationService.edit(station);

    }
    @RequestMapping("/queryListPage")
    public Object queryListPage(
            @RequestParam("pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){

        return stationService.queryListPage(pageNo,pageSize);

    }
    @ApiOperation(value = "工人查询岗位列表接口")
    @ApiImplicitParams(
        {
                @ApiImplicitParam(name = "content",value = "岗位或薪资关键字"),
                @ApiImplicitParam(name = "pageNo",value = "第几页"),
                @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
        }
    )
    @RequestMapping(value = "/laborQueryStationList",method = RequestMethod.POST)
    public Object laborQueryStationList(
            @RequestParam("content") String content,
            @RequestParam("pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return stationService.laborQueryStationList(content,pageNo,pageSize);
    }
    @ApiOperation(value = "劳务公司历史岗位详情查询接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "companyid",value = "劳务公司id"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
            }
    )
    //查询历史岗位详情
    @RequestMapping(value = "/queryHistoricalPositionDetails",method = RequestMethod.POST)
    public Object queryHistoricalPositionDetails(
            @RequestParam("companyid") Integer companyid,
            @RequestParam(value = "pageNo",required = false) Integer pageNo,
            @RequestParam(value = "pageSize" ,required = false,defaultValue = "10") Integer pageSize
    ){
        return stationService.queryHistoricalPositionDetails(companyid,pageNo, pageSize);
    }

    @ApiOperation(value = "劳务公司历史岗位列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "companyid",value = "劳务公司ID"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
            }
    )

    /*
    查询历史岗位
     */
    @RequestMapping(value = "/HistoricalPositionList",method = RequestMethod.POST)
    public Object HistoricalPositionList(
            @RequestParam(value = "companyid") String companyid,
            @RequestParam(value = "pageNo",required = false,defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return stationService.HistoricalPositionList(companyid,pageNo,pageSize);
    }
    @RequestMapping(value = "/companyqueryListPage")
    public Object companyqueryListPage(
            @RequestParam(value = "companyId") String companyId,
            @RequestParam(value = "pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return stationService.companyqueryListPage(companyId,pageNo,pageSize);
    }
}
